<template>
    <tr>
      <td> <input type="checkbox" v-model="obj.checked"> </td>
          <td>{{obj.name}}</td>
          <td>{{obj.price}}</td>
          <td> <button @click="obj.num === 1?1:obj.num--">-</button> {{obj.num}} <button @click="obj.num++">+</button> </td>
          <td>{{total}}</td>
          <td> <button @click="del(obj.name)">删除</button> </td>
    </tr>
</template>

<script>
export default {
  data () {
    return {
    }
  },
  props: ['obj'],
  computed: {
    total () {
      return this.obj.price * this.obj.num
    }
  },

  methods: {
    del () {
      this.$emit('BtnDel', this.obj.name)
    }
  }
}
</script>

<style scoped lang='less'>

</style>
